
function Base(){
	
	/**
	 * test
	 */
	this.baseUrl = "http://112.124.121.34:7069/shihou.extra.wage.mainstage";
	this.baseUrl1 = "http://112.124.121.34:8201/lion_module_share_temp";
	this.listURl = "http://test.youxiduo.com/iweb/shi_xin_bu_chang/phb.html";
	this.taskUserCenterURL = "http://112.124.121.34:8201/lion_module_share_temp/task/user_center";//?uid=214445&plantId=4PLwi6yLVak6
	/**
	 * real
	 *
	this.baseUrl = "http://api.shihou.youxiduo.com/shihou.extra.wage.mainstage";
	this.baseUrl1 = "http://event.m.shihou.tv/lion_module_share_temp";
	this.listURl = "http://test.youxiduo.com/iweb/shi_xin_bu_chang/phb.html";
	this.taskUserCenterURL = "http://event.m.shihou.tv/lion_module_share_temp/task/user_center";//?uid=214445&plantId=4PLwi6yLVak6
	*/
	this.userCenterURL = this.baseUrl + "/UserCenter";
	this.rankURL = this.baseUrl + "/DailyRank";
	this.baomingURL = this.baseUrl1 + "/ajax_sign_up";	
	this.dateTime = 20170303;
	this.filterUserURL = this.baseUrl + '/FilterUser/Query';
	this.extraWageConfig = this.baseUrl + '/ExtraWageConfig/Query';
	this.init();
}

Base.prototype = {
	init:function(){
		var _this = this;
		//_this.refleshCache();//上线时要注释掉 TODO
	},
	refleshCache:function(){
		var _this = this;
		_this.requestRemoteData("http://112.124.121.34:8201/lion_module_share_temp/backdoor/validShareConfig", {}, function(data){
			_this.logResult(data);
			_this.log("刷新缓存结束");
		});
	},
	parseResult:function(){
		var size = arguments.length;
		if(size == 0){
			return ;
		}
		var result = arguments[0];
		for(var i = 1; i < size; i++){
			if(result == undefined){
				return ;
			}
			var argu = arguments[i];
			if(i == size){
				return argu;
			}
			result = result[argu];
		}
		return result;
	},
	requestRemoteData: function(url, data, callback){
		this.logURL(url);
		this.logParameter(data);
		var begin = (new Date()).getTime();
		$.ajax({
	        url: url,
	        type: 'GET',
	        async: true,
	        dataType: "html",
	        data: data,
	        success: callback,
	        error: function (data) {
	        	var status = data.status;
	        	console.log(url + "获取数据失败!");
	        }
	    });
	},
	requestRemoteDataJson: function(url, data, callback){
		this.logURL(url);
		this.logParameter(data);
		var begin = (new Date()).getTime();
		$.ajax({
	        url: url,
	        type: 'GET',
	        async: false,
	        cache: false, 
	        dataType: "json",
	        data: data,
	        success: callback,
	        error: function (data) {
	        	var status = data.status;
	        	console.log(url + "获取数据失败!");
	        }
	    });
	},
	preDate:function(){
		if(new Date().getHours()<12){
			return this.GetDateStr(-2);
		}else{
			return this.GetDateStr(-1);
		}
	},
	GetDateStr:function(AddDayCount) { 
		var dd = new Date(); 
		dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期 
		var y = dd.getFullYear(); 
		var m = dd.getMonth()+1;//获取当前月份的日期 
		var d = dd.getDate(); 
		if(m < 10)
			m = "0"+m;
		if(d < 10)
			d = "0"+d;
		return y+""+m+""+d; 
	},
	log:function(data){
		console.log(data);
	},
	logURL:function(url){
		console.log("url --> "+url);
	},
	logParameter:function(data){
		console.log("parameter --> "+JSON.stringify(data));
	},
	logResult:function(result){
		console.log("result --> "+JSON.stringify(result));
	}
};
